/*
 * Copyright 2003-2006 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */


//%nodefaultctor type_library;
//%nodefaultdtor type_library;

%ignore	type_library::error;
%ignore	type_library::types;
%ignore	type_library::names;

%fix_naming_to( type_library, TypeLibrary );

%exception type_library_register_bind
{
	BeginArgotExc
	ArgotExc( TYPE_NAME_INVALID, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid parameter: structure, reader and writer cannot be None or invalid" )
	ArgotExc( TYPE_BAD_STATE, SWIG_ValueError, "type is in a bad state, neither in state 'defined' nor 'reserved' or definition is None" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "invalid state" )
	EndArgotExc
}
%exception type_library::register_bind
{
	BeginArgotExc
	ArgotExc( TYPE_NAME_INVALID, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid parameter: structure, reader and writer cannot be None or invalid" )
	ArgotExc( TYPE_BAD_STATE, SWIG_ValueError, "type is in a bad state, neither in state 'defined' nor 'reserved' or definition is None" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "invalid state" )
	EndArgotExc
}

%exception type_library_register
{
	BeginArgotExc
	ArgotExc( TYPE_BAD_NAME, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid type parameter; structure cannot be None" )
	ArgotExc( TYPE_DEFINED, SWIG_ValueError, "type is already defined" )
	ArgotExc( TYPE_BAD_STATE, SWIG_ValueError, "type is in a bad state, definition is None" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "invalid state" )
	EndArgotExc
}
%exception type_library::Register
{
	BeginArgotExc
	ArgotExc( TYPE_BAD_NAME, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid type parameter; structure cannot be None" )
	ArgotExc( TYPE_DEFINED, SWIG_ValueError, "type is already defined" )
	ArgotExc( TYPE_BAD_STATE, SWIG_ValueError, "type is in a bad state, definition is None" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "invalid state" )
	EndArgotExc
}


%exception type_library_reserve
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NAME_DEFINED, SWIG_ValueError, "name is already defined" )
	EndArgotExc
}
%exception type_library::reserve
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NAME_DEFINED, SWIG_ValueError, "name is already defined" )
	EndArgotExc
}

%exception type_library_bind
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NOT_DEFINED, SWIG_ValueError, "type not defined" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "type in wrong state" )
	EndArgotExc
}
%exception type_library::Bind
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NOT_DEFINED, SWIG_ValueError, "type not defined" )
	ArgotExc( TYPE_INVALID_STATE, SWIG_ValueError, "type in wrong state" )
	EndArgotExc
}

%exception type_library_get_id
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NOT_DEFINED, SWIG_ValueError, "type not defined" )
	EndArgotExc
}
%exception type_library::get_id
{
	BeginArgotExc
	ArgotExc( TYPE_INVALID_PARAM, SWIG_ValueError, "invalid name" )
	ArgotExc( TYPE_NOT_DEFINED, SWIG_ValueError, "type not defined" )
	EndArgotExc
}

%exception type_library_get_name
{
	ArgotNullExc( SWIG_ValueError, "type not found" )
}
%exception type_library::get_name
{
	ArgotNullExc( SWIG_ValueError, "type not found" )
}

%define excNotDefinedOrComplete
	ArgotNullExc( SWIG_ValueError, "type not defined or not complete" )
%enddef

%exception type_library_get_structure
{
	excNotDefinedOrComplete
}
%exception type_library::get_structure
{
	excNotDefinedOrComplete
}

%exception type_library_get_definition
{
	ArgotNullExc( SWIG_ValueError, "invalid name or type not defined" )
}
%exception type_library::get_definition
{
	ArgotNullExc( SWIG_ValueError, "invalid name or type not defined" )
}

%exception type_library_get_definition_id
{
	excNotDefinedOrComplete
}
%exception type_library::get_definition_id
{
	excNotDefinedOrComplete
}

%exception type_library_get_reader
{
	excNotDefinedOrComplete
}
%exception type_library::get_reader
{
	excNotDefinedOrComplete
}

%exception type_library_get_writer
{
	excNotDefinedOrComplete
}
%exception type_library::get_writer
{
	excNotDefinedOrComplete
}




%argot_library_callback_code_forward_decl
	
%include "TypeLibrary.h"

%argot_library_callback_code

%set_constructor_0( type_library, type_library_init );
%type_library_destructor

%add_bound_method( type_library, int, Register, type_library_register, type_name * name, type_element * structure );
%add_bound_method( type_library, int, reserve, type_library_reserve, type_name * name );

%add_prop( type_library, int, Error, type_library_get_error, type_library_set_error )

%add_bound_method( type_library, int, get_state, type_library_get_state, type_name * name )
%add_bound_method( type_library, int, get_id_type_state, type_library_get_id_type_state, int id )
%add_bound_method( type_library, int, get_id, type_library_get_id, type_name * name )
%add_bound_method( type_library, type_name*, get_name, type_library_get_name, int id )
%add_bound_method( type_library, type_element*, get_structure, type_library_get_structure, int id )
%add_bound_method( type_library, type_reader*, get_reader, type_library_get_reader, int id )
%add_bound_method( type_library, type_writer*, get_writer, type_library_get_writer, int id )
%add_bound_method( type_library, type_definition*, get_definition, type_library_get_definition, type_name * name )
%add_bound_method( type_library, type_definition*, get_definition_id, type_library_get_definition_id, int id )

